<template>
  <div class="acquaintance">
    <div class="newItem" v-show="majorData.label">
      <div class="title">第一印象</div>
      <div class="inlineList">
        <div class="inlineItem" v-for="(item, index) of labelList" :key="index">{{ item }}</div>
      </div>
    </div>
    <div class="newItem" v-show="majorData.introduction">
      <div class="title">专业介绍</div>
      <div class="content">{{ majorData.introduction }}</div>
    </div>
    <div class="newItem" v-show="majorData.rel_colleges">
      <div class="title">对应院系</div>
      <div class="content">{{ majorData.rel_colleges }}</div>
    </div>
    <div class="newItem" v-show="majorData.rel_classes">
      <div class="title">专业核心课程   </div>
      <div class="blockList">
        <div class="blockItem" v-for="(item, index) of classesList" :key="index">{{ item }}</div>
      </div>
    </div>
    <div class="newItem" v-show="majorData.rel_skills">
      <div class="title">相关技能</div>
      <div class="blockList">
        <div class="blockItem" v-for="(item, index) of skillList" :key="index">{{ item }}</div>
      </div>
    </div>
    <div class="newItem" v-show="majorData.rel_majors">
      <div class="title">相关专业</div>
      <div class="blockList">
        <div class="blockItem" v-for="(item, index) of relMajorsList" :key="index">{{ item }}</div>
      </div>
    </div>

  </div>  
</template>

<script>
export default {
  name: 'Acquaintance',
  props: {
    majorData: Object
  },
  data() {
    return {
      labelList: [], // 第一印象列表
      classesList: [], // 专业核心课程列表
      skillList: [], // 相关技能列表
      relMajorsList: [], // 相关专业列表
    }
  },
  watch: {
    majorData(obj) {
      this.labelList = obj.label ? obj.label.split(',') : []
      this.classesList = obj.rel_classes ? obj.rel_classes.split(',') : []
      this.skillList = obj.rel_skills ? obj.rel_skills.split(',') : []
      this.relMajorsList = obj.rel_majors ? obj.rel_majors.split(',') : []
    }
  },
  methods: {
  }
}
</script>

<style lang="less" scoped>
  .acquaintance {
    .newItem {
      padding-bottom: 0.48rem;
      border-bottom: 1px solid #E5E8ED;
      margin-bottom: 0.4rem;
      .title {
        color: #222;
        font-size: 0.3rem;
        font-weight: bold;
        line-height: 0.44rem;
        margin-bottom: 0.4rem;
      }
      .inlineList {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        .inlineItem {
          color: #222;
          font-size: 0.28rem;
          line-height: 0.4rem;
          margin-right: 0.2rem;
        }
      }
      .content {
        color: #222;
        font-size: 0.28rem;
        line-height: 0.4rem;
      }
      .blockList {
        .blockItem {
          color: #222;
          font-size: 0.28rem;
          line-height: 0.4rem;
        }
      }
    }
    .newItem:last-child {
      border: none;
      margin: 0;
    }
  }
</style>
